Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

230
Vistas
discord.js - TypeError [COMMAND_INTERACTION_OPTION_TYPE]: Option "user" is of type: STRING; expected USER

When I run the script for my discord bot and use /warn remove it keeps throwing an error that user is of type string expected USER. It says the error is happening between lines 69:42 and I can't find the issue.

module.exports = {
    category: 'Moderation',
    description: 'Warn a user',

    permissions: ['ADMINISTRATOR'],
    
    slash: true,
    guildOnly: true,

    options: [
        {
            type: 'SUB_COMMAND',
            name: 'remove',
            description: 'Removes a warning from the user',
            options: [
                {
                    name: 'user',
                    type: 'USER',
                    description: 'The user to remove the warning from',
                    required: true,
                },
                {
                    name: 'id',
                    type: 'STRING',
                    description: 'The ID of the warning to remove',
                    required: true,
                },
            ],
        }
    ],

    callback: async ({ guild, member: staff, interaction }) => {
        const user = interaction.options.getUser('user')

        if (subCommand === 'remove') {
            const warning = await warnSchema.findByIdAndDelete(id)

            return {
                custom: true,
                content: `Removed warning ${warning.id} from  <@${user?.id}>`,
                allowedMentions: {
                    users: []
                }
            }
        }
    }
}

I didn't post all the code because it seemed like it would be too much searching but this is the code that is causing the error.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda